

import { Input } from "antd";
import { XxtreeSelect, XxCascader, XxTextArea, XxSelect, XxRangePicker, XxDatePicker } from "@/ui";

// 根据type值判断返回Input框还是Select框还是别的.
export const showValueType = ({ form, TYPE, inputProps }) => {
    switch (TYPE) {
        // 如果是Select，则渲染select组件并且遍历Options   optionlist={optionlist}
        case "Select": return <XxSelect {...inputProps} onSelect={value => form.setFieldsValue({ state: value })} />;
        case "DatePicker": return <XxDatePicker {...inputProps} />;
        case "RangePicker": return <XxRangePicker {...inputProps} onSelect={value => form.setFieldsValue({ state: value })} />;
        case "Cascader": return <XxCascader {...inputProps} onSelect={value => form.setFieldsValue({ state: value })} />;
        case "TextArea": return <XxTextArea  {...inputProps} onSelect={value => form.setFieldsValue({ state: value })} />;
        case "TreeSelect": return <XxtreeSelect  {...inputProps} onSelect={value => form.setFieldsValue({ state: value })} />
        // 默认渲染Input组件
        default: return <Input value={"input text"} allowClear {...inputProps} />;
    }
}